<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/qt3support/painting/q3paintdevicemetrics.cpp -->
<head>
  <title>Qt 4.3: Q3PaintDeviceMetrics Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">Q3PaintDeviceMetrics Class Reference<br /><sup><sup>[<a href="qt3support.html">Qt3Support</a> module]</sup></sup></h1>
<p>The Q3PaintDeviceMetrics class provides information about a paint device. <a href="#details">More...</a></p>
<pre> #include &lt;Q3PaintDeviceMetrics&gt;</pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qpaintdevicemetrics">Porting to Qt 4</a> for more information.</p>
<ul>
<li><a href="q3paintdevicemetrics-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="q3paintdevicemetrics.html#Q3PaintDeviceMetrics">Q3PaintDeviceMetrics</a></b> ( const QPaintDevice * <i>pd</i> )</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#depth">depth</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#height">height</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#heightMM">heightMM</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#logicalDpiX">logicalDpiX</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#logicalDpiY">logicalDpiY</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#numColors">numColors</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#width">width</a></b> () const</li>
<li><div class="fn"/>int <b><a href="q3paintdevicemetrics.html#widthMM">widthMM</a></b> () const</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The Q3PaintDeviceMetrics class provides information about a paint device.</p>
<p>Sometimes when drawing graphics it is necessary to obtain information about the physical characteristics of a paint device. This class provides the information. For example, to compute the aspect ratio of a paint device:</p>
<pre> Q3PaintDeviceMetrics pdm(myWidget);
 double aspect = (double)pdm.widthMM() / (double)pdm.heightMM();</pre>
<p>Q3PaintDeviceMetrics contains methods to provide the width and height of a device in both pixels (<a href="q3paintdevicemetrics.html#width">width</a>() and <a href="q3paintdevicemetrics.html#height">height</a>()) and millimeters (<a href="q3paintdevicemetrics.html#widthMM">widthMM</a>() and <a href="q3paintdevicemetrics.html#heightMM">heightMM</a>()), the number of colors the device supports (<a href="q3paintdevicemetrics.html#numColors">numColors</a>()), the number of bit planes (<a href="q3paintdevicemetrics.html#depth">depth</a>()), and the resolution of the device (<a href="q3paintdevicemetrics.html#logicalDpiX">logicalDpiX</a>() and <a href="q3paintdevicemetrics.html#logicalDpiY">logicalDpiY</a>()).</p>
<p>It is not always possible for Q3PaintDeviceMetrics to compute the values you ask for, particularly for external devices. The ultimate example is asking for the resolution of of a <a href="qprinter.html">QPrinter</a> that is set to &quot;print to file&quot;: who knows what printer that file will end up on?</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="Q3PaintDeviceMetrics"></a>Q3PaintDeviceMetrics::Q3PaintDeviceMetrics ( const <a href="qpaintdevice.html">QPaintDevice</a> * <i>pd</i> )</h3>
<p>Constructs a metric for the paint device <i>pd</i>.</p>
<h3 class="fn"><a name="depth"></a>int Q3PaintDeviceMetrics::depth () const</h3>
<p>Returns the bit depth (number of bit planes) of the paint device.</p>
<h3 class="fn"><a name="height"></a>int Q3PaintDeviceMetrics::height () const</h3>
<p>Returns the height of the paint device in default coordinate system units (e.g&#x2e; pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>).</p>
<h3 class="fn"><a name="heightMM"></a>int Q3PaintDeviceMetrics::heightMM () const</h3>
<p>Returns the height of the paint device, measured in millimeters.</p>
<h3 class="fn"><a name="logicalDpiX"></a>int Q3PaintDeviceMetrics::logicalDpiX () const</h3>
<p>Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X, this is usually the same as could be computed from <a href="q3paintdevicemetrics.html#widthMM">widthMM</a>(), but it varies on Windows.</p>
<h3 class="fn"><a name="logicalDpiY"></a>int Q3PaintDeviceMetrics::logicalDpiY () const</h3>
<p>Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X, this is usually the same as could be computed from <a href="q3paintdevicemetrics.html#heightMM">heightMM</a>(), but it varies on Windows.</p>
<h3 class="fn"><a name="numColors"></a>int Q3PaintDeviceMetrics::numColors () const</h3>
<p>Returns the number of different colors available for the paint device. Since this value is an int will not be sufficient to represent the number of colors on 32 bit displays, in which case INT_MAX is returned instead.</p>
<h3 class="fn"><a name="width"></a>int Q3PaintDeviceMetrics::width () const</h3>
<p>Returns the width of the paint device in default coordinate system units (e.g&#x2e; pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>).</p>
<h3 class="fn"><a name="widthMM"></a>int Q3PaintDeviceMetrics::widthMM () const</h3>
<p>Returns the width of the paint device, measured in millimeters.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
